/*    */ package com.zimbra.cs.redolog.op;
/*    */ 
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.cs.mailbox.MailServiceException;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.MailboxManager;
/*    */ import com.zimbra.cs.mailbox.MailboxOperation;
/*    */ import com.zimbra.cs.mime.ParsedMessage;
/*    */ import com.zimbra.cs.redolog.RedoLogInput;
/*    */ import com.zimbra.cs.redolog.RedoLogOutput;
/*    */ import java.io.IOException;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class CreateChat
/*    */   extends CreateMessage
/*    */ {
/*    */   public CreateChat()
/*    */   {
/* 32 */     this.mOperation = MailboxOperation.CreateChat;
/*    */   }
/*    */   
/*    */   public CreateChat(int mailboxId, String digest, int msgSize, int folderId, int flags, String[] tags) {
/* 36 */     super(mailboxId, ":API:", false, digest, msgSize, folderId, true, flags, tags);
/* 37 */     this.mOperation = MailboxOperation.CreateChat;
/*    */   }
/*    */   
/*    */   protected void serializeData(RedoLogOutput out) throws IOException
/*    */   {
/* 42 */     super.serializeData(out);
/*    */   }
/*    */   
/*    */   protected void deserializeData(RedoLogInput in) throws IOException
/*    */   {
/* 47 */     super.deserializeData(in);
/*    */   }
/*    */   
/*    */   public void redo() throws Exception
/*    */   {
/* 52 */     int mboxId = getMailboxId();
/* 53 */     Mailbox mbox = MailboxManager.getInstance().getMailboxById(mboxId);
/*    */     
/* 55 */     ParsedMessage pm = new ParsedMessage(getMessageBody(), Long.valueOf(getTimestamp()), mbox.attachmentsIndexingEnabled());
/*    */     try {
/* 57 */       mbox.createChat(getOperationContext(), pm, getFolderId(), getFlags(), getTags());
/*    */     } catch (MailServiceException e) {
/* 59 */       if (e.getCode() == "mail.ALREADY_EXISTS") {
/* 60 */         mLog.info("Chat " + getMessageId() + " is already in mailbox " + mboxId);
/* 61 */         return;
/*    */       }
/* 63 */       throw e;
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/redolog/op/CreateChat.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */